/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
/**
 *
 * @author ANH
 */
public class Pause {
    private Image alert;
    private Image yes;
    private Image no;
    public boolean isyes;
    public boolean isshow;
    public Pause()
    {
        isshow=false;
    }
    public void loadGraphics(Image _alert,Image _yes,Image _no)
    {
        alert=_alert;
        yes=_yes;
        no=_no;
    }
    public void Render(Graphics g)
    {
        int anchor = Graphics.TOP|Graphics.LEFT;
        if(isshow)
        {
            g.drawImage(alert, 40,100 , anchor);
            g.drawImage(yes, 35, 150, anchor);
            g.drawImage(no, 135, 150, anchor);
        }
    }
    private final Rectangle getAreaYes() {

         return new Rectangle(50, 150,80 , 44);
    }
    private final Rectangle getAreaNo() {

         return new Rectangle(140, 150,80 , 44);
    }
    public final boolean isPressedYes(int x, int y) {
        return getAreaYes().isPointInside(x, y);
    }
    public final boolean isPressedNo(int x, int y) {
        return getAreaNo().isPointInside(x, y);
    }
    public boolean OnSelelected(int x,int y){// dành cho chạm( tạm thời)
        if(isPressedYes(x,y))
        {
            isshow=false;
            return true;
        }
        else if(isPressedNo(x,y))
        {
            isshow=false;
            return false;
        }
        return false;
    }
    public void IsShow()
    {
        isshow=true;
    }
    public void IsHide()
    {
        isshow=false;
    }
}
